﻿//   Copyright 2009 Pyxis Technologies
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//

using Pyxis.FluentSelenium.Locator;

namespace Pyxis.FluentSelenium.Tester
{
    static class Assert
    {
        public static void ContentMatch(string expectedText, string acctualText, ILocator locator)
        {
            if (expectedText != acctualText)
                throw ConditionError.ContentNotMatch(expectedText, acctualText, locator);
        }

        public static void ElementIsNotVisible(bool elementIsVisible, ILocator targetElementLocator)
        {
            if (elementIsVisible)
                throw ConditionError.ElementShouldNotBeVisible(targetElementLocator);
        }

        public static void ExpectedElementCount(int expectedItemCount, int acctualItemCount, ElementLocator countExpresssion)
        {
            if (expectedItemCount != acctualItemCount)
                throw ConditionError.ElementCountDoesNotMatch(expectedItemCount, acctualItemCount, countExpresssion);
        }

        public static void ShouldBeChecked(bool isChecked, string locator)
        {
            if (!isChecked)
                throw ConditionError.ElementShouldNotBeChecked(locator);
        }

        public static void ShouldNotBeChecked(bool isChecked, string locator)
        {
            if (isChecked)
                throw ConditionError.ElementShouldBeChecked(locator);
        }
    }
}
